import set from '@dfeidao/atom-web/local/set';
import fire from '@dfeidao/atom-web/msg/fire';
import { IFeidaoAiBrowserComponent } from '@dfeidao/web/interfaces';

// import set from '@feidao/web/atom/browser/local/set';
// import fire from '@feidao/web/atom/browser/msg/fire';

// 选中当前行
export default async function a004(fd: IFeidaoAiBrowserComponent, args: Event) {
	const target_node = args.currentTarget as HTMLDivElement;
	set(fd, 'add', true);
	const id = target_node.getAttribute('data-feidao-id');
	const _no = target_node.getAttribute('data-feidao-no');
	const name = target_node.getAttribute('data-feidao-name');
	const create_time = target_node.getAttribute('data-feidao-create_time');

	set(fd, '_id', id);
	set(fd, '_no', _no);
	set(fd, 'name', name);
	set(fd, 'create_time', create_time);
	const items = fd.data.node.querySelectorAll<HTMLInputElement>('[data-alert_list]');
	Array.from(items).forEach((i) => {
		i.classList.remove('bg-c');
	});
	target_node.closest('[data-alert_list]').classList.add('bg-c');
	target_node.closest('[data-alert_list]').classList.add('data-bs');

	fire('zj-000002', 'ec-001', _no, _no);

}
